package de.uni_mannheim.informatik.ai.dame_ai.util;

import java.awt.Dialog;
import java.awt.Point;
import java.awt.Window;


@SuppressWarnings("serial")
public class ModalDialog extends Dialog {
	/**
	 * A simple modal dialog which appears in the center of its owner.
	 * @param owner The owner of the dialog. He will be disabled until the user responds.
	 * @param title The title for the dialog frame.
	 */
	public ModalDialog(Window owner, String title, int width, int height){
		super(owner, title);
		setSize(width, height);
		Point ownerLoc=getOwner().getLocationOnScreen();
		int ownerWidth=getOwner().getWidth();
		int ownerHeight=getOwner().getHeight();
		int xOffset=(ownerWidth-width)/2;
		int yOffset=(ownerHeight-height)/2;
		setBounds(ownerLoc.x+xOffset, ownerLoc.y+yOffset, width, height);
		setResizable(false);
		setModal(true);
	}
}